package com.sinodata.common
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	import mx.controls.Alert;
	
	public class InitConfigApplication
	{
		public static var service_url_app:String="";
		
		public static function loadServiceUrl():String{
			if(InitConfigApplication.service_url_app==''){
				InitConfigApplication.init();
			}
			return InitConfigApplication.service_url_app;
		}
		
		protected static function init():void   
		{   
			var urlrequest:URLRequest=new URLRequest("initAppConfig.xml");   
			var loader:URLLoader=new URLLoader();   
			loader.load(urlrequest);   
			loader.addEventListener(Event.COMPLETE, completehandler);   
		}   
		
		private static function completehandler(event:Event):void   
		{   
			var xml:XML=new XML(event.target.data);   
			//Alert.show(xml.toString()); 
			var service_ip:String=xml.service_ip;
			var service_port:String=xml.service_port;
			var service_url:String=xml.serviceurl;
			var url_app:String=service_ip+":"+service_port+service_url;
			
			InitConfigApplication.service_url_app=url_app;
			Alert.show("service_url_app="+url_app);
			Alert.show("InitConfigApplication._service_url_app="+InitConfigApplication.service_url_app);
		}   
		
		public function InitConfigApplication(){
			
		}
	}
}